//
//  MAPYSpeedResultInfoCell.swift
//  Mars Proxy
//
//  Created by PowerfullClean on 2023/10/17.
//

import UIKit

class MAPYSpeedResultInfoCell: MAPYTestResultInfoCell {
    override init(frame: CGRect) {
        super.init(frame: frame)
        mapy_iconView3.addSubview(mapy_downloadView)
        mapy_iconView3.addSubview(mapy_uploadView)
        mapy_iconView3.addSubview(mapy_pingView)
        mapy_iconView3.addSubview(mapy_lossView)
        mapy_iconView3.addSubview(mapy_jitterView)
        mapy_downloadView.snp.makeConstraints { make in
            make.width.equalTo(mapy_w/2.0)
            make.left.equalToSuperview().offset(56)
            make.top.equalToSuperview()
            make.height.equalTo(66)
        }
        mapy_uploadView.snp.makeConstraints { make in
            make.width.equalTo(mapy_w/2.0)
            make.right.equalToSuperview()
            make.top.equalToSuperview()
            make.height.equalTo(66)
        }
        mapy_pingView.snp.makeConstraints { make in
            make.width.equalTo(mapy_w/3.0)
            make.left.equalToSuperview().offset(56)
            make.bottom.equalToSuperview()
            make.height.equalTo(66)
        }
        mapy_lossView.snp.makeConstraints { make in
            make.width.equalTo(mapy_w/3.0)
            make.centerX.equalToSuperview()
            make.bottom.equalToSuperview()
            make.height.equalTo(66)
        }
        mapy_jitterView.snp.makeConstraints { make in
            make.width.equalTo(mapy_w/3.0)
            make.right.equalToSuperview()
            make.bottom.equalToSuperview()
            make.height.equalTo(66)
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    var mapy_speedValueModel: MAPYSpeedValueModel? {
        didSet {
            guard let mapy_speedValueModel = mapy_speedValueModel else { return }
            mapy_downloadView.mapy_valueLabel.text = mapy_speedValueModel.mapy_download
            mapy_uploadView.mapy_valueLabel.text = mapy_speedValueModel.mapy_upload
            mapy_pingView.mapy_valueLabel.text = mapy_speedValueModel.mapy_ping
            mapy_lossView.mapy_valueLabel.text = mapy_speedValueModel.mapy_loss
            mapy_jitterView.mapy_valueLabel.text = mapy_speedValueModel.mapy_jitter
        }
    }
    lazy var mapy_downloadView: MAPYTestResultInfoItemView = {
        let mapy_downloadView = MAPYTestResultInfoItemView()
        mapy_downloadView.mapy_titleLabel.text = "Download"
        mapy_downloadView.mapy_valueLabel.text = "0"
        return mapy_downloadView
    }()
    lazy var mapy_uploadView: MAPYTestResultInfoItemView = {
        let mapy_uploadView = MAPYTestResultInfoItemView()
        mapy_uploadView.mapy_titleLabel.text = "Upload"
        mapy_uploadView.mapy_valueLabel.text = "0"
        return mapy_uploadView
    }()
    lazy var mapy_pingView: MAPYTestResultInfoItemView = {
        let mapy_pingView = MAPYTestResultInfoItemView()
        mapy_pingView.mapy_titleLabel.text = "Ping"
        mapy_pingView.mapy_valueLabel.text = "0"
        return mapy_pingView
    }()
    lazy var mapy_lossView: MAPYTestResultInfoItemView = {
        let mapy_lossView = MAPYTestResultInfoItemView()
        mapy_lossView.mapy_titleLabel.text = "Loss"
        mapy_lossView.mapy_valueLabel.text = "0"
        return mapy_lossView
    }()
    lazy var mapy_jitterView: MAPYTestResultInfoItemView = {
        let mapy_jitterView = MAPYTestResultInfoItemView()
        mapy_jitterView.mapy_titleLabel.text = "Jitter"
        mapy_jitterView.mapy_valueLabel.text = "0"
        return mapy_jitterView
    }()
}
